﻿using Ec_System.Models.Web;
using Ec_System.Service.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ec_System.Bll.Web
{
    public class AreasManager
    {
        AreasService areasService = new AreasService();

        /// <summary>
        /// 获取所有的行政区
        /// </summary>
        /// <returns></returns>
        public AreasData GetAllAreas()
        {
            var areaList = areasService.GetAllAreas();
            var model = new AreasData()
            {
                ProviceList = areaList.Where(item => item.Area_ID.Length == 2).ToList(),
                CityList = areaList.Where(item => item.Area_ID.Length  == 4).ToList(),
                TownList = areaList.Where(item => item.Area_ID.Length == 6).ToList()
            };

            return model;
        }
    }
}
